import React from 'react';
import { format } from '@/utils/datetime';
import CommonPage from '@/components/page/CommonPage';

const daoName = 'BaseKhjlZbzs';
const columns: API.Column[] = [
  {
    title: '生效日期',
    width: 100,
    sorter: true,
    caption: 'DTID',
    key: 'DTID',
    render: (data) => format(data.DTID, 'yyyy-MM-dd'),
    dispaly: true,
    filter: true,
  },
  {
    title: '指标名称',
    width: 180,
    sorter: true,
    key: 'ZBNO',
    caption: 'ConfKhjlZb.ZBMC',
    render: (data) => data.ConfKhjlZb.ZBMC,
    dispaly: true,
    filter: true,
  },
  {
    title: '指标分值',
    width: 100,
    sorter: true,
    dataIndex: 'ZBFZ',
    key: 'ZBFZ',
    dispaly: true,
    filter: true,
  },
];
const controls: API.Control[] = [
  {
    name: 'DTID',
    label: '生效日期',
    type: 'date',
    grid: 12 / 24,
    dataType: 'date',
    rules: [{ required: true }],
  },
  {
    name: 'ZBNO',
    label: '指标名称',
    type: 'select',
    grid: 12 / 24,
    rules: [{ required: true }],
    fetch: { tableName: 'ConfKhjlZb', optionTpl: 'ZBMC', valueTpl: 'ZBID' },
    dataType: 'number',
    // seekType: 2,
    placeholder: '请选择指标...',
  },
  {
    name: 'ZBFZ',
    rules: [{ required: true }],
    type: 'number',
    label: '指标分值',
    grid: 12 / 24,
    dataType: 'number',
  },
];
const ShIndiKhjlZbzsForm: React.FC = () => {
  return (
    <CommonPage
      daoName={daoName}
      columns={columns}
      controls={controls}
      keyColName={'FZID'}
      initSorter={{ FieldName: 'FZID', Direction: 'DESC' }}
    />
  );
};

export default ShIndiKhjlZbzsForm;
